# 业务数据库 -> ODS -> DWD -> DWS -> MySQL
# 这个脚本文件主要用于MySQL导入到OBS相关的工作

# 一：将MySQL数据导入ODS层
# 1.1 导入数据到web_chat_ems表
sqoop import \
--connect jdbc:mysql://192.168.10.150:3306/nev \
--username root --password 123456 \
--query "SELECT   
  id,create_date_time,session_id,sid,create_time,
  seo_source,seo_keywords,ip,area,country,province,
  city,origin_channel,user AS user_match,manual_time,
  begin_time,end_time,last_customer_msg_time_stamp,
  last_agent_msg_time_stamp,reply_msg_count,msg_count,
  browser_name,os_info, CURRENT_DATE() AS start_time
FROM  web_chat_ems_2019_07 where 1=1 and \$CONDITIONS" \
--fields-terminated-by '\t' \
--hcatalog-database itcast_ods \
--hcatalog-table web_chat_ems \
-m 3 \
--split-by id

# 1.2 导入数据到web_chat_text_ems表
sqoop import \
--connect jdbc:mysql://192.168.10.150:3306/nev \
--username root --password 123456 \
--query "SELECT  
id,referrer,from_url,landing_page_url,
url_title,platform_description,
other_params,history, CURRENT_DATE() AS start_time
FROM web_chat_text_ems_2019_07 where 1=1 and \$CONDITIONS" \
--fields-terminated-by '\t' \
--hcatalog-database itcast_ods \
--hcatalog-table web_chat_text_ems \
-m 3 \
--split-by id
